#include "jsapi.h"
#include "js-engine.h"
#include "desktopClasses.h"
#include "mainview-parser.h"

static JSBool scrollbar_new(JSContext *cx, JSObject *obj, uintN argc, jsval *args, jsval *rval);

struct JSFunctionSpec scrollbar_methods[] = {
    {NULL, NULL}
};

static JSClass scrollbarClass =
    { "scrollbar", JSCLASS_HAS_PRIVATE,
      JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
      JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
      JSCLASS_NO_OPTIONAL_MEMBERS
    };

struct property_parser scrollbar_parser[] = {
    {"background", set_property_string_value},
    {"leftDownImage", set_property_string_value},
    {"leftImage", set_property_string_value},
    {"leftOverImage", set_property_string_value},
    {"lineStep", set_property_integer_value},
    {"max", set_property_integer_value},
    {"min", set_property_integer_value},
    {"orientation", set_property_string_value},
    {"pageStep", set_property_integer_value},
    {"rightDownImage", set_property_string_value},
    {"rightImage", set_property_string_value},
    {"rightOverImage", set_property_string_value},
    {"thumbDownImage", set_property_string_value},
    {"thumbImage", set_property_string_value},
    {"thumbOverImage", set_property_string_value},
    {"value", set_property_integer_value},
    {NULL, NULL},
};

static JSBool scrollbar_new(JSContext *cx, JSObject *obj, uintN argc, jsval *args, jsval *rval)
{
    g_message("scrollbar new");
    return JS_TRUE;
}

JSObject *scrollbarClass_init(js_engine *engine, JSObject *parent)
{
    JSObject *proto = NULL;
    proto = JS_InitClass(engine->cx, engine->glob, parent,
			 &scrollbarClass, scrollbar_new,
			 0,NULL,NULL,NULL,NULL);
    g_return_val_if_fail(proto, FALSE);
    g_return_val_if_fail(JS_DefineFunctions(engine->cx, proto, scrollbar_methods), FALSE);
    return proto;
}
